function JT_init(img_container, input){
  var parent = (input == null) ? 'a.jTip' : input+'.jTip';
  $(parent).hover(
	   function(){
	   		var width = parseInt($('.JT_width'+ this.id).val());
	   		if(img_container != '' || img_container != null){
	   			JT_create_image(img_container + this.id);
	   		}
	   		if(width <= 0){ width = 180; }
	   		JT_show($('span.img_content' + this.id).html(), width);
	   },
	   function(){  
	   		$('#JT').remove();
	   }
	);
  	$(parent).mousemove(function(e){
		jt_height = $('#JT').height();
		jt_width  = $('#JT').width();
		ox = e.pageX + 5;
  		oy = e.pageY + 22;
  		border = (navigator.appName == 'Microsoft Internet Explorer') ? 25 : 1;
  		max_x  = $(document).width() - border;
		if (self.innerHeight) { // Everyone but IE
			max_y  = window.pageYOffset + $(window).height() - border;
		} else if (document.documentElement && document.documentElement.clientHeight) { // IE6 Strict
			max_y  = document.documentElement.scrollTop + $(window).height() - border;
		} else if (document.body) { // Other IE, such as IE7
			max_y  = document.body.scrollTop + $(window).height() - border;
		}
  		if((e.pageX + 5 + jt_width) >= max_x) ox = e.pageX - jt_width - 5;
  		if((e.pageY + 22 + jt_height) > max_y) oy = e.pageY - jt_height - 10;
  		$('#JT').css({left: ox+"px", top: oy+"px"});
	});
}
function JT_show(content,width){
	$("body").append("<div id='JT'><div id='JT_copy' style='width:"+width+"px;'></div></div>");
	$('#JT_copy').html(content);
	$('#JT').show();
}
function JT_create_image(id){
	$(id).parents("center").addClass('moi_nhat_load_image_preview');
	var div_img = $(id);
//	div_img.addClass('moi_nhat_load_image_preview');
	if(!div_img.hasClass('created')){
		var img_src = div_img.html();
		div_img.html('<img src="'+img_src+'" onload="show_image_content(this);" class="image_jtip" />');
		div_img.addClass('created');
	}
}
function show_image_content(obj,speed){
	$(obj).fadeTo(400,1);
}